package com.sooth.system.dept.view;

import com.dream.system.annotation.View;
import com.dream.util.tree.Tree;
import com.sooth.system.dept.table.SysDept;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
@View(SysDept.class)
public class SysDeptVo implements Tree<Long> {

    /**
     * 部门id
     */
    private Long deptId;

    /**
     * 父部门id
     */
    private Long parentId;

    /**
     * 部门名称
     */
    private String deptName;

    private List<SysDeptVo> children;

    @Override
    public Long getTreeId() {
        return deptId;
    }

    @Override
    public List<? extends Tree> getChildrenOrNew() {
        if (children == null) {
            children = new ArrayList<>();
        }
        return children;
    }
}
